本文整理汇总了C++中RS函数的典型用法代码示例。如果您正苦于以下问题:C++ RS函数的具体用法?C++ RS怎么用?C++ RS使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: memcpy
//-------------------------------------------------------------
// Name: RestoreDeviceObjects()
// Desc: 화면크기가 변했을때 호출됨
// 확보한 메모리는 InvalidateDeviceObjects()에서 해제
//-------------------------------------------------------------
HRESULT CMyD3DApplication::RestoreDeviceObjects()
{
// 정점과 색정보
CUSTOMVERTEX vertices[] = {
// x, y, z,
{-0.5f, +0.5f, 0},
{+0.5f, +0.5f, 0},
{-0.5f, -0.5f, 0},
{+0.5f, -0.5f, 0},
};
// 정점버퍼 생성
if( FAILED( m_pd3dDevice->CreateVertexBuffer(
4*sizeof(CUSTOMVERTEX), // 정점버퍼 크기
0, D3DFVF_CUSTOMVERTEX, // 사용법, 정점포맷
D3DPOOL_DEFAULT, // 메모리 클래스
&m_pVB, NULL ))) // 정점버퍼 리소스
return E_FAIL;
// 정점버퍼에 정보 저장
VOID* pVertices;
if(FAILED( m_pVB->Lock(0, sizeof(vertices), (void**)&pVertices, 0)))
return E_FAIL;
memcpy( pVertices, vertices, sizeof(vertices) );
m_pVB->Unlock();
// 단축매크로
#define RS m_pd3dDevice->SetRenderState
#define TSS m_pd3dDevice->SetTextureStageState
#define SAMP m_pd3dDevice->SetSamplerState
// 렌더링 상태설정
RS( D3DRS_DITHERENABLE, FALSE );
RS( D3DRS_SPECULARENABLE, FALSE );
RS( D3DRS_ZENABLE, TRUE );
RS( D3DRS_AMBIENT, 0x000F0F0F );
TSS( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
TSS( 0, D3DTSS_COLORARG1, D3DTA_DIFFUSE );
// 폰트
m_pFont->RestoreDeviceObjects();
// 뷰행렬 설정
D3DXVECTOR3 vEye = D3DXVECTOR3( 0.0f, 0.0f, 1.0f );
D3DXVECTOR3 vAt = D3DXVECTOR3( 0.0f, 0.0f, 0.0f );
D3DXVECTOR3 vUp = D3DXVECTOR3( 0.0f, 1.0f, 0.0f );
D3DXMatrixLookAtRH( &m_matView, &vEye, &vAt, &vUp );
// 투영행렬 설정
FLOAT fAspectRatio = (FLOAT)m_d3dsdBackBuffer.Width
/ (FLOAT)m_d3dsdBackBuffer.Height;
D3DXMatrixPerspectiveFovRH( &m_matProj, D3DXToRadian(60.0f),
fAspectRatio, 0.1f, 100.0f );
return S_OK;
}
示例2: is_immediate_pair
bool is_immediate_pair(inst_t* instp) {
// find out if instp points to lis followed by ori/addi/load/store
inst_t i1 = instp[0];
if (!is_lis(i1)) return false;
fint reg = RT(i1);
inst_t i2 = instp[1];
return
is_ori(i2) && RA(i2) == reg && RS(i2) == reg
|| is_addi(i2) && RT(i2) == reg && RS(i2) == reg
|| is_load_store_immediate(i2) && RA(i2) == reg;
}
示例3: data
static void data(unsigned char data)
{
RS(1);
udelay(40);
LCD(data >> 4);
lcd_strobe();
LCD(data);
lcd_strobe();
udelay(10);
RS(0);
udelay(10);
}
示例4: D3DUtil_InitMaterial
//-------------------------------------------------------------
// Name: RestoreDeviceObjects()
// Desc: 화면크기가 변했을때 호출됨
// 확보한 메모리는 InvalidateDeviceObjects()에서 해제
//-------------------------------------------------------------
HRESULT CMyD3DApplication::RestoreDeviceObjects()
{
// 메시
m_pMesh ->RestoreDeviceObjects( m_pd3dDevice );
m_pMeshBg->RestoreDeviceObjects( m_pd3dDevice );
// 셰이더
m_pEffect->OnResetDevice();
// 재질설정
D3DMATERIAL9 mtrl;
D3DUtil_InitMaterial( mtrl, 1.0f, 0.0f, 0.0f );
m_pd3dDevice->SetMaterial( &mtrl );
// 렌더링 상태설정
RS( D3DRS_DITHERENABLE, FALSE );
RS( D3DRS_SPECULARENABLE, FALSE );
RS( D3DRS_ZENABLE, TRUE );
RS( D3DRS_AMBIENT, 0x000F0F0F );
RS( D3DRS_LIGHTING, TRUE );
TSS( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );
TSS( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
TSS( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
TSS( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 );
TSS( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
SAMP( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
SAMP( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
SAMP( 0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP );
SAMP( 0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP );
// 월드행렬
D3DXMATRIX matIdentity;
D3DXMatrixIdentity( &m_mWorld );
// 뷰행렬
D3DXVECTOR3 vFromPt = D3DXVECTOR3( 0.0f, 0.0f, -5.0f );
D3DXVECTOR3 vLookatPt = D3DXVECTOR3( 0.0f, 0.0f, 0.0f );
D3DXVECTOR3 vUpVec = D3DXVECTOR3( 0.0f, 1.0f, 0.0f );
D3DXMatrixLookAtLH( &m_mView, &vFromPt, &vLookatPt, &vUpVec );
// 투영행렬
FLOAT fAspect = ((FLOAT)m_d3dsdBackBuffer.Width) / m_d3dsdBackBuffer.Height;
D3DXMatrixPerspectiveFovLH( &m_mProj, D3DX_PI/4, fAspect, 1.0f, 100.0f );
// 폰트
m_pFont->RestoreDeviceObjects();
return S_OK;
}
示例5: D3DXComputeNormals
//-------------------------------------------------------------
// Name: RestoreDeviceObjects()
// Desc: 화면크기가 변했을때 호출됨
// 확보한 메모리는 InvalidateDeviceObjects()에서 해제
//-------------------------------------------------------------
HRESULT CMyD3DApplication::RestoreDeviceObjects()
{
// 이펙트
if(m_pEffect) m_pEffect->OnResetDevice();
// 메시
m_pMeshBg->RestoreDeviceObjects( m_pd3dDevice );
//---------------------------------------------------------
// FVF로 처리하지 않은 정점선언은 직접 처리
//---------------------------------------------------------
if( m_pMesh && m_pMesh->GetSysMemMesh() ){
LPD3DXMESH pMesh;
m_pMesh->GetSysMemMesh()->CloneMesh(
m_pMesh->GetSysMemMesh()->GetOptions(), decl,
m_pd3dDevice, &pMesh );
D3DXComputeNormals( pMesh, NULL );
D3DXComputeTangent( pMesh, 0, 0, 0, TRUE, NULL );
SAFE_RELEASE(m_pMesh->m_pLocalMesh);
m_pMesh->m_pLocalMesh = pMesh;
}
// 렌더링 상태설정
RS( D3DRS_ZENABLE, TRUE );
RS( D3DRS_LIGHTING, FALSE );
SAMP( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
SAMP( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
SAMP( 0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP );
SAMP( 0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP );
// 뷰행렬
D3DXVECTOR3 vFromPt = D3DXVECTOR3( 0.0f, 0.0f, -5.0f );
D3DXVECTOR3 vLookatPt = D3DXVECTOR3( 0.0f, 0.0f, 0.0f );
D3DXVECTOR3 vUpVec = D3DXVECTOR3( 0.0f, 1.0f, 0.0f );
D3DXMatrixLookAtLH( &m_mView, &vFromPt, &vLookatPt, &vUpVec );
// 투영행렬
FLOAT fAspect = ((FLOAT)m_d3dsdBackBuffer.Width) / m_d3dsdBackBuffer.Height;
D3DXMatrixPerspectiveFovLH( &m_mProj, D3DX_PI/4, fAspect, 1.0f, 100.0f );
// 폰트
m_pFont->RestoreDeviceObjects();
return S_OK;
}
示例6: handleVector
void handleVector(std::vector < libmaus2::dazzler::align::Overlap > & VOVL, libmaus2::dazzler::align::AlignmentWriter & AW)
{
uint64_t maxaepos = 0;
for ( uint64_t i = 0; i < VOVL.size(); ++i )
maxaepos = std::max(maxaepos,static_cast<uint64_t>(VOVL[i].path.aepos));
libmaus2::util::SimpleQueue< libmaus2::geometry::RangeSet<ReadInterval>::search_q_element > SQ;
libmaus2::geometry::RangeSet<ReadInterval> RS(maxaepos);
for ( uint64_t i = 0; i < VOVL.size(); ++i )
{
uint64_t const abpos = VOVL[i].path.abpos;
uint64_t const aepos = VOVL[i].path.aepos;
uint64_t const nf = RS.search(ReadInterval(abpos,aepos,i),SQ);
bool const primary = (! nf);
if ( primary )
{
VOVL[i].setPrimary();
//std::cerr << "primary " << VOVL[i] << std::endl;
RS.insert(ReadInterval(abpos,aepos,i));
}
else
{
//std::cerr << "secondary " << VOVL[i] << std::endl;
}
}
for ( uint64_t i = 0; i < VOVL.size(); ++i )
AW.put(VOVL[i]);
VOVL.resize(0);
}
示例7: SetServerText
void SetServerText()
{
char localbuf[80];
wsprintf(localbuf, RS(IDS_BBSERV), nConnections);
SetWindowText(hMainWnd, localbuf);
}
示例8: sin
std::vector<typename TransformationLayer<Dtype>::Affine2D>
TransformationLayer<Dtype>::generate(int N, int W, int H, int Wo, int Ho) {
std::vector<Affine2D> r;
for (int i = 0; i < N; i++) {
if (synchronized_ && i) {
r.push_back(r.back());
} else {
Dtype rot = 0, scale = 1, sx = 0, sy = 0;
if (rotate_) caffe_rng_uniform<Dtype>(1, -M_PI, M_PI, &rot);
Dtype sin_rot = sin(rot);
Dtype cos_rot = cos(rot);
Dtype rot_w = Wo*fabs(cos_rot) + Ho*fabs(sin_rot);
Dtype rot_h = Wo*fabs(sin_rot) + Ho*fabs(cos_rot);
Dtype max_scale = std::min(max_scale_, std::min(H / rot_h, W / rot_w));
Dtype min_scale = std::min(min_scale_, max_scale);
caffe_rng_uniform<Dtype>(1, min_scale, max_scale, &scale);
Dtype scl_w = std::min(rot_w * scale, Dtype(W));
caffe_rng_uniform<Dtype>(1, -(W-scl_w)/2, (W-scl_w)/2, &sx);
Dtype scl_h = std::min(rot_h * scale, Dtype(H));
caffe_rng_uniform<Dtype>(1, -(H-scl_h)/2, (H-scl_h)/2, &sy);
Affine2D T0(1, 0, 0, 1, -0.5*Wo, -0.5*Ho);
Affine2D RS(scale * cos_rot, -scale * sin_rot,
scale * sin_rot, scale * cos_rot, 0, 0);
if (mirror_ && caffe_rng_rand()&1) {
RS.a00_ = -RS.a00_;
RS.a10_ = -RS.a10_;
}
Affine2D T1(1, 0, 0, 1, 0.5*W + sx, 0.5*H + sy);
r.push_back(T1*RS*T0);
}
}
return r;
}
示例9: main
int main(int argc, const char *argv[]) {
enablePool(RPool);
ComplexTest();
// [ ] , [ [ [ ] ] ], [ [ ] [] [ ] ]
const RString *source = RS(" ++++++++++ [ >+++++++>++++++++++>+++>+<<<<- ] >++\n"
" .>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.\n"
" ------.--------.>+.>.");
RVirtualFunction *function = c(RVirtualFunction)(nil);
function->name = RSC("Hello");
function->masterRDataObject = makeRDataAllocated(5);
function->masterRDataObject->data[0] = r_addition;
function->masterRDataObject->data[1] = 0x01;
function->masterRDataObject->data[2] = r_addition;
function->masterRDataObject->data[3] = 0x23;
function->masterRDataObject->data[4] = r_end;
// brainfuck hard(with [, ]) hello world on RVM
// RVirtualFunction *function = $(RVC, m(createFunctionFromBrainFuckSourceCode, RVirtualCompiler)), source );
p(RVirtualFunction)(function);
executeRay(function);
deleter(function, RVirtualFunction);
deleter(RVM, RVirtualMachine);
deleter(RVC, RVirtualCompiler);
endRay();
}
示例10: KSPFGMRESBuildSoln
static PetscErrorCode KSPFGMRESBuildSoln(PetscScalar *nrs,Vec vguess,Vec vdest,KSP ksp,PetscInt it)
{
PetscScalar tt;
PetscErrorCode ierr;
PetscInt ii,k,j;
KSP_FGMRES *fgmres = (KSP_FGMRES*)(ksp->data);
PetscFunctionBegin;
/* Solve for solution vector that minimizes the residual */
/* If it is < 0, no fgmres steps have been performed */
if (it < 0) {
ierr = VecCopy(vguess,vdest);CHKERRQ(ierr); /* VecCopy() is smart, exists immediately if vguess == vdest */
PetscFunctionReturn(0);
}
/* so fgmres steps HAVE been performed */
/* solve the upper triangular system - RS is the right side and HH is
the upper triangular matrix - put soln in nrs */
if (*HH(it,it) != 0.0) {
nrs[it] = *RS(it) / *HH(it,it);
} else {
nrs[it] = 0.0;
}
for (ii=1; ii<=it; ii++) {
k = it - ii;
tt = *RS(k);
for (j=k+1; j<=it; j++) tt = tt - *HH(k,j) * nrs[j];
nrs[k] = tt / *HH(k,k);
}
/* Accumulate the correction to the soln of the preconditioned prob. in
VEC_TEMP - note that we use the preconditioned vectors */
ierr = VecSet(VEC_TEMP,0.0);CHKERRQ(ierr); /* set VEC_TEMP components to 0 */
ierr = VecMAXPY(VEC_TEMP,it+1,nrs,&PREVEC(0));CHKERRQ(ierr);
/* put updated solution into vdest.*/
if (vdest != vguess) {
ierr = VecCopy(VEC_TEMP,vdest);CHKERRQ(ierr);
ierr = VecAXPY(vdest,1.0,vguess);CHKERRQ(ierr);
} else { /* replace guess with solution */
ierr = VecAXPY(vdest,1.0,VEC_TEMP);CHKERRQ(ierr);
}
PetscFunctionReturn(0);
}
示例11: RI8
rdfheaderrec *rdfgetheaderrec(rdffile *f)
{
static rdfheaderrec r;
int i;
if (!f->header_loc) {
rdf_errno = 5;
return NULL;
}
if (f->header_fp >= f->header_len) return 0;
RI8(r.type);
switch(r.type) {
case 1: /* Relocation record */
RI8(r.r.segment);
RI32(r.r.offset);
RI8(r.r.length);
RI16(r.r.refseg);
break;
case 2: /* Imported symbol record */
RI16(r.i.segment);
RS(r.i.label,32);
break;
case 3: /* Exported symbol record */
RI8(r.e.segment);
RI32(r.e.offset);
RS(r.e.label,32);
break;
case 4: /* DLL record */
RS(r.d.libname,127);
break;
case 5: /* BSS reservation record */
RI32(r.b.amount);
break;
default:
rdf_errno = 2; /* invalid file */
return NULL;
}
return &r;
}
示例12: store_inferior_registers
void
store_inferior_registers (int regno)
{
struct reg inferior_registers;
#ifdef PT_SETFPREGS
struct fpreg inferior_fp_registers;
#endif
int i;
for (i = 0; i < 32; i++)
RS (i, inferior_registers.fixreg[i]);
RS (PPC_LR_REGNUM, inferior_registers.lr);
RS (PPC_CR_REGNUM, inferior_registers.cr);
RS (PPC_XER_REGNUM, inferior_registers.xer);
RS (PPC_CTR_REGNUM, inferior_registers.ctr);
RS (PC_REGNUM, inferior_registers.pc);
ptrace (PT_SETREGS, inferior_pid,
(PTRACE_ARG3_TYPE) & inferior_registers, 0);
#ifdef PT_SETFPREGS
for (i = 0; i < 32; i++)
RS (FP0_REGNUM + i, inferior_fp_registers.r_regs[i]);
ptrace (PT_SETFPREGS, inferior_pid,
(PTRACE_ARG3_TYPE) & inferior_fp_registers, 0);
#endif
}
示例13: cmd
static void cmd(unsigned char command)
{
RS(0);
udelay(40);
LCD(command >> 4);
lcd_strobe();
LCD(command);
lcd_strobe();
}
示例14: SetClientText
void SetClientText()
{
char localbuf[80];
wsprintf(localbuf, RS(bConnected ? IDS_BBON : IDS_BBOFF),
(LPSTR)szServerName);
SetWindowText(hMainWnd, localbuf);
}
示例15: taskENTER_CRITICAL
void LCD1602::Locate(int col, int row)
{
taskENTER_CRITICAL();
RS(false);
DB(0x80 | (row << 6) | col);
LCD_DELAY_WRITE;
taskEXIT_CRITICAL();
}